<include file="public:top" />
<!--编辑菜单-->
<form class="layui-form layui-form-pane" action="" style="padding:20px;">
    <input type="hidden" name="id" value="{$info.id}" />
    <input type="hidden" name="logo" id="J_img" value="{$info.logo}">
   
  <div class="layui-form-item">
    <label class="layui-form-label">名称</label>
    <div class="layui-input-block">
      <input type="text" class="layui-input" value="{$info.name} - 禁止编辑" disabled="">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">英文标识</label>
    <div class="layui-input-block">
      <input type="text" class="layui-input"  value="{$info.mark} - 禁止编辑" disabled="">
    </div>
  </div>
   
  <div class="layui-form-item">
    <label class="layui-form-label">{:L('article_cate_img')}</label>
    <div class="layui-input-block"> 
       <button type="button" class="layui-btn layui-btn-primary" id="upimg"><i class="layui-icon"></i>只允许图片文件</button>
       <div class="layui-form-mid " style="width: 100%"><img src="" height="36" id="imgval" style="max-width:450px;display: none;"></div>
    </div>
  </div>

  <if condition="$info.mark eq 'Wechat'">
    <div class="layui-form-item">
    <label class="layui-form-label">AppID</label>
    <div class="layui-input-block">
      <input type="text" name="appid" id="appid" placeholder="公众号ID" class="layui-input" value="{$info.appid}">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">MchID</label>
    <div class="layui-input-block">
      <input type="text" name="merchant" id="merchant" placeholder="微信支付商户号" class="layui-input" value="{$info.merchant}">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">Key</label>
    <div class="layui-input-block">
      <input type="text" name="key" id="key" placeholder="商户支付秘钥Key" class="layui-input" value="{$info.key}">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">Appsecret</label>
    <div class="layui-input-block">
      <input type="text" name="appsecret" id="appsecret" placeholder="请输入" class="layui-input" value="{$info.appsecret}">
    </div>
  </div>
<else /> 

  <div class="layui-form-item">
    <label class="layui-form-label">商户账号</label>
    <div class="layui-input-block">
      <input type="text" name="merchant" id="merchant" placeholder="请输入" class="layui-input" value="{$info.merchant}">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">商户ID</label>
    <div class="layui-input-block">
      <input type="text" name="account" id="account" placeholder="请输入" class="layui-input" value="{$info.account}">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">key</label>
    <div class="layui-input-block">
      <input type="text" name="key" id="key" placeholder="请输入" class="layui-input" value="{$info.key}">
    </div>
  </div>

</if>
  
  <div class="layui-form-item">
    <label class="layui-form-label">描述</label>
    <div class="layui-input-block">
      <textarea name="description" id="description" class="layui-textarea">{$info.description}</textarea>
    </div>
  </div>
  <div class="layui-form-item" pane>
    <label class="layui-form-label">{:L('enabled')}</label>
    <div class="layui-input-block">
      <input type="radio" name="status" value="1" title="是" class="layui-radio" <if condition="$info.status eq 1"> checked="checked"</if>>
      <input type="radio" name="status" value="0" title="否" class="layui-radio" <if condition="$info.status eq 0"> checked="checked"</if>>
    </div>
  </div>
 
  <div class="layui-form-item">
    <button class="layui-btn" lay-submit="" lay-filter="content_edit">立即提交</button>
    <button class="layui-btn layui-btn-primary" onClick="history.go(-1)">返回</button>
  </div>
</form>
<script type="text/javascript" src="__PUBLIC__/admin/layui/layui.js"></script>
<script>
layui.use(['layer','jquery','form','upload'], function () {
   // 操作对象
    var layer = layui.layer,$ = layui.jquery,form = layui.form, upload = layui.upload;

    //判断是否有图片
    var  str='{$info.logo}';
    if (str !== '') {
      $('#imgval').show().attr('src','{:attach($info[\'logo\'], \'payment\')}'); 
    }

  //上传图片
    upload.render({
      elem: '#upimg'
      ,url: "{:U('payment/ajax_upload_img')}"
      ,acceptMime: 'image/*'
      ,done: function(res, index, upload){
        if (res.status == 1) {
          layer.msg('上传成功',{time:1800});
          var path = "{:attach('"+res.info+"', 'payment')}";

         
          $('#J_img').val(res.info);
          $('#imgval').show().attr('src',path); 
        }else {
          layer.msg('上传失败',{time:1800});
        }
      }
    });

  Oper.initUpdate(layui, '单页', 'content_edit', 'payment/edit', 'payment/index');
});
</script>
</body>
</html>